package com.doit.day01;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseConfiguration;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.*;

import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;

public class _05_修改表里面的属性 {
    public static void main(String[] args) throws IOException {
        Configuration conf = HBaseConfiguration.create();
        //设置参数
        conf.set("hbase.zookeeper.quorum","linux01:2181,linux02:2181,linux03:2181");
        //创建连接对象
        Connection conn = ConnectionFactory.createConnection(conf);
        //获取连接对象
        Admin admin = conn.getAdmin();
        //因为创建表的描述器构建器需要一个表名TableName对象
        TableName tableName = TableName.valueOf("test:teacher");
        //创建一个表的描述器构建器
/*        TableDescriptorBuilder tableDescriptorBuilder = TableDescriptorBuilder.newBuilder(tableName);
        //构建列族描述器，就需要先构建一个列族描述器的构建器
        ColumnFamilyDescriptorBuilder columnFamilyDescriptorBuilder = ColumnFamilyDescriptorBuilder.newBuilder("base_info".getBytes(StandardCharsets.UTF_8));
        //设置一些参数
        ColumnFamilyDescriptor build1 = columnFamilyDescriptorBuilder.build();*/

        //修改表的属性
//        tableDescriptorBuilder.modifyColumnFamily(build1);

        //删除表的属性
//        tableDescriptorBuilder.removeColumnFamily("base_info".getBytes(StandardCharsets.UTF_8));

        //TableName tableName, ColumnFamilyDescriptor columnFamily

        //修改一个列族的属性信息
//        admin.modifyColumnFamily(tableName,build1);

        //百度  cv工程师呢

        //删除一个列族
        admin.deleteColumnFamily(tableName,"base_info".getBytes(StandardCharsets.UTF_8));

    }
}
